package com.wiegand.gui.text.effects {
	import com.caurina.transitions.Tweener;

	import flash.filters.DropShadowFilter;
	import flash.filters.GlowFilter;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	/**
	 * @author kwiegand
	 */
	public class Decoding extends AbstractTxtEffect implements IEffects {

		private var _txt : String;
		private var _tf : DecodingTextField;
		private var _format : TextFormat;

		public function Decoding( txt : String ):void{
					
			_txt = txt;
			
			init();
		
		}
		
		private function init():void{
				
			_format = new TextFormat();
            _format.font = "Verdana";
            _format.color = 0xffffff;
            _format.size = 60;
            			
			_tf = new DecodingTextField();
			_tf.text = _txt;
			_tf.autoSize = TextFieldAutoSize.LEFT;
			_tf.multiline = true;
			_tf.width = 800;
			_tf.wordWrap = true;
		
			_tf.setTextFormat( _format );
		
			_tf.delay = 50;
			
			_tf.x = 80;
			_tf.y = 50;
		
			_tf.filters = [ new GlowFilter( 0x000000, 0.1, 10, 10, 5, 5 ), new DropShadowFilter( 5, 45, 0x000000, 1, 1, 1, 5, 5 ) ]; 
			
			addChild( _tf );
			
			
		}
		
		public override function close() : void {
			
			trace( "close text" );
			
			Tweener.removeTweens( _tf );
			Tweener.addTween( _tf, { alpha:0, time:0.5, transition:"linear" } );
			
		}
		
		public override function clear() : void {
			
			trace("clear text");
			
			Tweener.removeTweens( _tf );
			
		}
		
		
	}
}
